﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThietBi.BLL;
using QuanLyThietBi.DAL.Models;

namespace QuanLyThietBi
{
    public partial class ThemSuaLoaiThietBi : Form
    {
        public ThemSuaLoaiThietBi()
        {
            InitializeComponent();
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            bool hople = true;
            if (string.IsNullOrEmpty(txtLoaiThietBi.Text.Trim()))
            {
                hople = false;
                txtLoaiThietBi.Focus();
                txtLoaiThietBi.BackColor = Color.Red;
            }
            else
            {
                LoaiThietBiBO ltbBO = new LoaiThietBiBO();

                var loaithietbi = new LOAITHIETBI()
                {
                     loai_thiet_bi = txtLoaiThietBi.Text.Trim(),
                     mo_ta = txtMoTa.Text.Trim()

                };

                ltbBO.SaveLoaiThietBi(loaithietbi);
                MessageBox.Show("Thêm thành công","Thông báo !!!");
            }
        }

        private void btnTroLai_Click(object sender, EventArgs e)
        {
            ThemMoiChinhSuaThietBi cstb = new ThemMoiChinhSuaThietBi();
            cstb.Show();
            this.Hide();
        }
    }
}
